/* ---------------------------------------------------------------------------
 * This software is in the public domain, furnished "as is", without technical
 * support, and with no warranty, express or implied, as to its usefulness for
 * any purpose.
 *
 * Parser.cpp
 *
 * Author: Guillaume Boissé
 * -------------------------------------------------------------------------*/

#include "Parser.h"
#include "Debug.h"
#include "File.h"

namespace jsp
{

Parser::Parser(const s8* pFilename)
{
    File file(pFilename);
    ASSERT(file.text());

    m_fileName = pFilename;
    m_fileContent = file.text();

    m_scanner.init(m_fileContent.c_str());
}

Parser::~Parser()
{
    m_scanner.term();
}

error_t Parser::parse()
{
    do
    {
        Token::Value token = m_scanner.current();

        // TODO: <- ...
    }
    while (m_scanner.next() != Token::EOS);

    return eError_Ok;
}

} // namespace jsp
